package com.hhtc.jsj.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hhtc.jsj.common.response.Result;
import com.hhtc.jsj.entity.PostOperate;
import com.hhtc.jsj.request.PostOperateRequest;
import com.hhtc.jsj.request.UserRequest;
import com.hhtc.jsj.service.PostOperateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 操作表 前端控制器
 * </p>
 *
 * @author ty
 * @since 2022-04-07
 */
@RestController
@RequestMapping("/postOperate")
public class PostOperateController {
    @Autowired
    private PostOperateService postOperateService;
    @PostMapping(value = "/add")
    public Result add(@RequestBody PostOperateRequest postOperateRequest){
        boolean add = postOperateService.add(postOperateRequest);
        return Result.OK(add);
    }
    @PostMapping(value = "/remove")
    public Result remove(@RequestBody PostOperateRequest postOperateRequest){
        boolean remove = postOperateService.remove(postOperateRequest);
        return Result.OK(remove);
    }
    @PostMapping(value = "/update")
    public Result update(@RequestBody PostOperateRequest postOperateRequest){
        boolean update = postOperateService.update(postOperateRequest);
        return Result.OK(update);
    }
    @PostMapping(value = "/getById")
    public Result getById(@RequestBody PostOperateRequest postOperateRequest){
        PostOperateRequest byId = postOperateService.getById(postOperateRequest);
        return Result.OK(byId);
    }
    @PostMapping(value = "/queryList")
    public Result queryList(@RequestBody PostOperateRequest postOperateRequest){
        List<PostOperateRequest> postOperateRequests = postOperateService.queryList(postOperateRequest);
        return Result.OK(postOperateRequests);
    }
    @PostMapping(value = "/page")
    public Result queryPage(@RequestBody PostOperateRequest postOperateRequest){
        Page page = postOperateService.queryPage(postOperateRequest);
        return Result.OK(page);
    }
}
